package chapter07

/**
 *
 * @author cdhuangchao3
 * @date 2023/6/10 11:33 AM
 */
object Test03_MulArray {
  def main(args: Array[String]): Unit = {
    // 1.创建二维数组
    val array = Array.ofDim[Int](2, 3)
    println(array)
    // 2.访问元素
    array(0)(2) = 19
    array(1)(0) = 25
    println(array.mkString(","))
    for (i <- array.indices; j <- array(i).indices) {
      print(array(i)(j) + "\t")
    }
    println("="*20)
    for (i <- array) {
      println(i.mkString(","))
    }
    println("="*20)
    array.foreach(line => line.foreach(println))
    println("="*20)
    array.foreach(_.foreach(println))
  }
}
